\hypertarget{classsock_1_1net_1_1_socket}{}\section{sock\+:\+:net\+:\+:Socket Class Reference}
\label{classsock_1_1net_1_1_socket}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}


套接字  




{\ttfamily \#include $<$socket.\+h$>$}

Inheritance diagram for sock\+:\+:net\+:\+:Socket\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classsock_1_1net_1_1_socket}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classsock_1_1net_1_1_socket_ae42299933b7d6448b99ab840f04471b8}{Socket} (sock\+\_\+t sock)
\item 
\hyperlink{classsock_1_1net_1_1_socket_ac9963a648d5421365c29dfc1af2acecb}{Socket} (int family, int type, int protocol)
\item 
\hyperlink{classsock_1_1net_1_1_socket_a763aae809efa471def8e7918281c3a1c}{$\sim$\+Socket} (void)
\item 
void \hyperlink{classsock_1_1net_1_1_socket_abf71d50699036a8a69cb362a9ac7ad02}{close} (void)
\item 
sock\+\_\+t \hyperlink{classsock_1_1net_1_1_socket_a31726f1fff129300731ef86d90b7eec4}{get\+Sock} (void) const 
\begin{DoxyCompactList}\small\item\em 获取本地套接字 \end{DoxyCompactList}\item 
int \hyperlink{classsock_1_1net_1_1_socket_a25675e062ae83762dd1e25ef745f6ba1}{receive} (char $\ast$buff, size\+\_\+t length, int flags=0)
\begin{DoxyCompactList}\small\item\em 接收数据 \end{DoxyCompactList}\item 
int \hyperlink{classsock_1_1net_1_1_socket_af2218f65624a640161009ddd0bfa509e}{send} (const char $\ast$buff, size\+\_\+t length, int flags=0)
\begin{DoxyCompactList}\small\item\em 发送数据 \end{DoxyCompactList}\item 
bool \hyperlink{classsock_1_1net_1_1_socket_ae714f7ccae9a27faf665ac3570022c3e}{getpeername} (struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)
\begin{DoxyCompactList}\small\item\em 获取套接字远程地址 \end{DoxyCompactList}\item 
bool \hyperlink{classsock_1_1net_1_1_socket_a91f3a52d5e6ede3892cc8cbd8ac34a13}{getsockname} (struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)
\begin{DoxyCompactList}\small\item\em 获取套接字本地地址 \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static bool \hyperlink{classsock_1_1net_1_1_socket_ad378344115303d72510ca9df7124629a}{set\+Option} (sock\+\_\+t sock, int level, int optname, const void $\ast$optval, socklen\+\_\+t optlen)
\begin{DoxyCompactList}\small\item\em 设置套接字选项 \end{DoxyCompactList}\item 
static bool \hyperlink{classsock_1_1net_1_1_socket_afbaabe6b8436c32418cd14a6253a1f70}{get\+Option} (sock\+\_\+t sock, int level, int optname, void $\ast$optval, socklen\+\_\+t $\ast$optlen)
\begin{DoxyCompactList}\small\item\em 获取套接字选项 \end{DoxyCompactList}\item 
static bool \hyperlink{classsock_1_1net_1_1_socket_ac128e602223fe5a9416b3f1a67009282}{set\+Nonblocking} (sock\+\_\+t sock, bool on)
\begin{DoxyCompactList}\small\item\em 设置\+I\+O阻塞状态 \end{DoxyCompactList}\item 
static bool \hyperlink{classsock_1_1net_1_1_socket_a2476dc993b75de2de00955468508fc8c}{set\+Linger} (sock\+\_\+t sock, bool on)
\begin{DoxyCompactList}\small\item\em 设置linger模式 \end{DoxyCompactList}\item 
static bool \hyperlink{classsock_1_1net_1_1_socket_a94e161e16e429d119a01aaf6c8a5f13a}{set\+Reuse\+Addr} (sock\+\_\+t sock, bool on)
\begin{DoxyCompactList}\small\item\em 设置重用地址 \end{DoxyCompactList}\item 
static void \hyperlink{classsock_1_1net_1_1_socket_a99e8e002c913cef15af249853acd0d66}{close} (sock\+\_\+t \&sock)
\begin{DoxyCompactList}\small\item\em 关闭套接字 \end{DoxyCompactList}\item 
static int \hyperlink{classsock_1_1net_1_1_socket_aad44251cdf6b0c9c32fd22f9e372dd7c}{receive} (sock\+\_\+t sock, char $\ast$buff, size\+\_\+t length, int flags=0)
\begin{DoxyCompactList}\small\item\em 接收数据 \end{DoxyCompactList}\item 
static int \hyperlink{classsock_1_1net_1_1_socket_a1185de0328e0ff6a2f2f10c0a6591a61}{send} (sock\+\_\+t sock, const char $\ast$buff, size\+\_\+t length, int flags=0)
\begin{DoxyCompactList}\small\item\em 发送数据 \end{DoxyCompactList}\item 
static bool \hyperlink{classsock_1_1net_1_1_socket_a2d2d51ecf142baed689d2baf9c90da70}{getpeername} (sock\+\_\+t sock, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)
\begin{DoxyCompactList}\small\item\em 获取套接字远程地址 \end{DoxyCompactList}\item 
static bool \hyperlink{classsock_1_1net_1_1_socket_ae4de126b57c1ed0851192b6a7434a37d}{getsockname} (sock\+\_\+t sock, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)
\begin{DoxyCompactList}\small\item\em 获取套接字本地地址 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
套接字 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classsock_1_1net_1_1_socket_ae42299933b7d6448b99ab840f04471b8}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!Socket@{Socket}}
\index{Socket@{Socket}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{Socket(sock\+\_\+t sock)}]{\setlength{\rightskip}{0pt plus 5cm}Socket\+::\+Socket (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [explicit]}}\label{classsock_1_1net_1_1_socket_ae42299933b7d6448b99ab840f04471b8}
\hypertarget{classsock_1_1net_1_1_socket_ac9963a648d5421365c29dfc1af2acecb}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!Socket@{Socket}}
\index{Socket@{Socket}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{Socket(int family, int type, int protocol)}]{\setlength{\rightskip}{0pt plus 5cm}Socket\+::\+Socket (
\begin{DoxyParamCaption}
\item[{int}]{family, }
\item[{int}]{type, }
\item[{int}]{protocol}
\end{DoxyParamCaption}
)}\label{classsock_1_1net_1_1_socket_ac9963a648d5421365c29dfc1af2acecb}
\hypertarget{classsock_1_1net_1_1_socket_a763aae809efa471def8e7918281c3a1c}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!````~Socket@{$\sim$\+Socket}}
\index{````~Socket@{$\sim$\+Socket}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{$\sim$\+Socket(void)}]{\setlength{\rightskip}{0pt plus 5cm}Socket\+::$\sim$\+Socket (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{classsock_1_1net_1_1_socket_a763aae809efa471def8e7918281c3a1c}


\subsection{Member Function Documentation}
\hypertarget{classsock_1_1net_1_1_socket_abf71d50699036a8a69cb362a9ac7ad02}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!close@{close}}
\index{close@{close}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{close(void)}]{\setlength{\rightskip}{0pt plus 5cm}void Socket\+::close (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{classsock_1_1net_1_1_socket_abf71d50699036a8a69cb362a9ac7ad02}
关闭套接字 \hypertarget{classsock_1_1net_1_1_socket_a99e8e002c913cef15af249853acd0d66}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!close@{close}}
\index{close@{close}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{close(sock\+\_\+t \&sock)}]{\setlength{\rightskip}{0pt plus 5cm}void Socket\+::close (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t \&}]{sock}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_a99e8e002c913cef15af249853acd0d66}


关闭套接字 


\begin{DoxyParams}{Parameters}
{\em sock} & 本地套接字 \\
\hline
\end{DoxyParams}
\hypertarget{classsock_1_1net_1_1_socket_afbaabe6b8436c32418cd14a6253a1f70}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!get\+Option@{get\+Option}}
\index{get\+Option@{get\+Option}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{get\+Option(sock\+\_\+t sock, int level, int optname, void $\ast$optval, socklen\+\_\+t $\ast$optlen)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::get\+Option (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{int}]{level, }
\item[{int}]{optname, }
\item[{void $\ast$}]{optval, }
\item[{socklen\+\_\+t $\ast$}]{optlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_afbaabe6b8436c32418cd14a6253a1f70}


获取套接字选项 


\begin{DoxyParams}{Parameters}
{\em sock} & 本地套接字 \\
\hline
{\em level} & 选项等级 \\
\hline
{\em optname} & 选项名 \\
\hline
{\em optval} & 选项值 \\
\hline
{\em optlen} & 选项长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bool 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_ae714f7ccae9a27faf665ac3570022c3e}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!getpeername@{getpeername}}
\index{getpeername@{getpeername}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{getpeername(struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::getpeername (
\begin{DoxyParamCaption}
\item[{struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t $\ast$}]{addrlen}
\end{DoxyParamCaption}
)}\label{classsock_1_1net_1_1_socket_ae714f7ccae9a27faf665ac3570022c3e}


获取套接字远程地址 


\begin{DoxyParams}{Parameters}
{\em addr} & 地址缓存 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_a2d2d51ecf142baed689d2baf9c90da70}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!getpeername@{getpeername}}
\index{getpeername@{getpeername}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{getpeername(sock\+\_\+t sock, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::getpeername (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t $\ast$}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_a2d2d51ecf142baed689d2baf9c90da70}


获取套接字远程地址 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字句柄 \\
\hline
{\em addr} & 地址缓存 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_a31726f1fff129300731ef86d90b7eec4}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!get\+Sock@{get\+Sock}}
\index{get\+Sock@{get\+Sock}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{get\+Sock(void) const }]{\setlength{\rightskip}{0pt plus 5cm}sock\+\_\+t sock\+::net\+::\+Socket\+::get\+Sock (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classsock_1_1net_1_1_socket_a31726f1fff129300731ef86d90b7eec4}


获取本地套接字 

\begin{DoxyReturn}{Returns}
sock\+\_\+t 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_a91f3a52d5e6ede3892cc8cbd8ac34a13}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!getsockname@{getsockname}}
\index{getsockname@{getsockname}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{getsockname(struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::getsockname (
\begin{DoxyParamCaption}
\item[{struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t $\ast$}]{addrlen}
\end{DoxyParamCaption}
)}\label{classsock_1_1net_1_1_socket_a91f3a52d5e6ede3892cc8cbd8ac34a13}


获取套接字本地地址 


\begin{DoxyParams}{Parameters}
{\em addr} & 地址缓存 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_ae4de126b57c1ed0851192b6a7434a37d}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!getsockname@{getsockname}}
\index{getsockname@{getsockname}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{getsockname(sock\+\_\+t sock, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::getsockname (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t $\ast$}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_ae4de126b57c1ed0851192b6a7434a37d}


获取套接字本地地址 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字句柄 \\
\hline
{\em addr} & 地址缓存 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_a25675e062ae83762dd1e25ef745f6ba1}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!receive@{receive}}
\index{receive@{receive}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{receive(char $\ast$buff, size\+\_\+t length, int flags=0)}]{\setlength{\rightskip}{0pt plus 5cm}int Socket\+::receive (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{buff, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{flags = {\ttfamily 0}}
\end{DoxyParamCaption}
)}\label{classsock_1_1net_1_1_socket_a25675e062ae83762dd1e25ef745f6ba1}


接收数据 


\begin{DoxyParams}{Parameters}
{\em buff} & 数据缓存 \\
\hline
{\em length} & 数据缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回接收的数据长度，如果套接字非阻塞且数据 已接收完返回\+S\+O\+C\+K\+E\+T\+\_\+\+E\+R\+R\+O\+R\+\_\+\+W\+O\+U\+L\+D\+B\+L\+O\+C\+K，错误返回\+S\+O\+C\+K\+E\+T\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_aad44251cdf6b0c9c32fd22f9e372dd7c}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!receive@{receive}}
\index{receive@{receive}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{receive(sock\+\_\+t sock, char $\ast$buff, size\+\_\+t length, int flags=0)}]{\setlength{\rightskip}{0pt plus 5cm}int Socket\+::receive (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{char $\ast$}]{buff, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{flags = {\ttfamily 0}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_aad44251cdf6b0c9c32fd22f9e372dd7c}


接收数据 


\begin{DoxyParams}{Parameters}
{\em sock} & 本地套接字 \\
\hline
{\em buff} & 数据缓存 \\
\hline
{\em length} & 数据缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回接收的数据长度，如果套接字非阻塞且数据 已接收完返回\+S\+O\+C\+K\+E\+T\+\_\+\+E\+R\+R\+O\+R\+\_\+\+W\+O\+U\+L\+D\+B\+L\+O\+C\+K，错误返回\+S\+O\+C\+K\+E\+T\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_af2218f65624a640161009ddd0bfa509e}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!send@{send}}
\index{send@{send}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{send(const char $\ast$buff, size\+\_\+t length, int flags=0)}]{\setlength{\rightskip}{0pt plus 5cm}int Socket\+::send (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{buff, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{flags = {\ttfamily 0}}
\end{DoxyParamCaption}
)}\label{classsock_1_1net_1_1_socket_af2218f65624a640161009ddd0bfa509e}


发送数据 


\begin{DoxyParams}{Parameters}
{\em buff} & 数据缓存 \\
\hline
{\em length} & 数据缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功发送接收的数据长度，如果套接字非阻塞且数据 发送缓存已满返回\+S\+O\+C\+K\+E\+T\+\_\+\+E\+R\+R\+O\+R\+\_\+\+W\+O\+U\+L\+D\+B\+L\+O\+C\+K，错误返回\+S\+O\+C\+K\+E\+T\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_a1185de0328e0ff6a2f2f10c0a6591a61}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!send@{send}}
\index{send@{send}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{send(sock\+\_\+t sock, const char $\ast$buff, size\+\_\+t length, int flags=0)}]{\setlength{\rightskip}{0pt plus 5cm}int Socket\+::send (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{const char $\ast$}]{buff, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{flags = {\ttfamily 0}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_a1185de0328e0ff6a2f2f10c0a6591a61}


发送数据 


\begin{DoxyParams}{Parameters}
{\em sock} & 本地套接字 \\
\hline
{\em buff} & 数据缓存 \\
\hline
{\em length} & 数据缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功发送接收的数据长度，如果套接字非阻塞且数据 发送缓存已满返回\+S\+O\+C\+K\+E\+T\+\_\+\+E\+R\+R\+O\+R\+\_\+\+W\+O\+U\+L\+D\+B\+L\+O\+C\+K，错误返回\+S\+O\+C\+K\+E\+T\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_a2476dc993b75de2de00955468508fc8c}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!set\+Linger@{set\+Linger}}
\index{set\+Linger@{set\+Linger}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{set\+Linger(sock\+\_\+t sock, bool on)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::set\+Linger (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{bool}]{on}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_a2476dc993b75de2de00955468508fc8c}


设置linger模式 


\begin{DoxyParams}{Parameters}
{\em on} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bool 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_ac128e602223fe5a9416b3f1a67009282}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!set\+Nonblocking@{set\+Nonblocking}}
\index{set\+Nonblocking@{set\+Nonblocking}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{set\+Nonblocking(sock\+\_\+t sock, bool on)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::set\+Nonblocking (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{bool}]{on}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_ac128e602223fe5a9416b3f1a67009282}


设置\+I\+O阻塞状态 


\begin{DoxyParams}{Parameters}
{\em on} & true表示设置成阻塞 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bool 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_ad378344115303d72510ca9df7124629a}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!set\+Option@{set\+Option}}
\index{set\+Option@{set\+Option}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{set\+Option(sock\+\_\+t sock, int level, int optname, const void $\ast$optval, socklen\+\_\+t optlen)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::set\+Option (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{int}]{level, }
\item[{int}]{optname, }
\item[{const void $\ast$}]{optval, }
\item[{socklen\+\_\+t}]{optlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_ad378344115303d72510ca9df7124629a}


设置套接字选项 


\begin{DoxyParams}{Parameters}
{\em sock} & 本地套接字 \\
\hline
{\em level} & 选项等级 \\
\hline
{\em optname} & 选项名 \\
\hline
{\em optval} & 选项值 \\
\hline
{\em optlen} & 选项长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bool 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_socket_a94e161e16e429d119a01aaf6c8a5f13a}{}\index{sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}!set\+Reuse\+Addr@{set\+Reuse\+Addr}}
\index{set\+Reuse\+Addr@{set\+Reuse\+Addr}!sock\+::net\+::\+Socket@{sock\+::net\+::\+Socket}}
\subsubsection[{set\+Reuse\+Addr(sock\+\_\+t sock, bool on)}]{\setlength{\rightskip}{0pt plus 5cm}bool Socket\+::set\+Reuse\+Addr (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{bool}]{on}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1net_1_1_socket_a94e161e16e429d119a01aaf6c8a5f13a}


设置重用地址 


\begin{DoxyParams}{Parameters}
{\em sock} & 本地套接字 \\
\hline
{\em on} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bool 
\end{DoxyReturn}


The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
E\+:/git/sock/sock/net/\hyperlink{socket_8h}{socket.\+h}\item 
E\+:/git/sock/src/net/\hyperlink{socket_8cc}{socket.\+cc}\end{DoxyCompactItemize}
